<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2019/5/8
  Time: 12:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="javabean.Userbean" %>
<jsp:useBean id="u1" class="javabean.Userbean" scope="session"/>

<html>
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <style type="text/css">
        body
        {
            text-align: center;
            background-image: url(1.jpg);
            background-repeat: no-repeat;
            background-size: 1550px 800px;
            background-attachment: fixed;
        }
        .div
        {
            border: 1px solid grey;
            border-radius: 10px 10px 10px 10px;
            width: 350px;
            height: 320px;
            margin: 0 auto;
            background-color:white;
            opacity: 0.7;
        }
        #div
        {
            height: 100px;
        }
        .div1
        {
            padding:10px;
            float: left;
        }
        .div2
        {
            padding:10px;
            float: right;
        }
        .div4
        {
            float: left;
            padding-left: 60px;
            padding-top: 15px;
            width: 250px;
        }
        .d1
        {
            padding-left: 53px;
            padding-top: 15px;
            float: left;
        }
        .d2
        {
            padding-left:64px;
            padding-top: 0px;
            float: left;
        }
        .d3
        {
            padding-left: 37px;
            padding-top: 15px;
            float: left;
        }
        .i1
        {
            padding: 2px 0 5px 6px;
        }
        .sub1
        {
            width: 100px;
            height: 30px;
            color: white;
            background-color:orange;
            border: none;
            margin-right: 15px;
        }
        .message
        {
            width: 300px;
            height: 15px;
            float: left;
            font-size: 10px;
            color: red;
        }
    </style>
</head>
<body>
<%
    String error1 = " ";
    String error2 = " ";
    String password = null;
    String cpass = null;
    if(session.getAttribute("users")!=null)
    {
        u1 = (Userbean)session.getAttribute("users");
        password = u1.getPassword();
        cpass = u1.getConfirmpassword();
    }
    if(password!=null&&!password.equals(cpass))
    {
        error2 = "两次密码不一致!";
    }
    else if(u1.localexist())
    {
        error1 = "该用户名已存在!";
    }
    else;
%>
<div id="div"></div>
<div class="div">
    <form action="/register" method="post">
        <div class="div1">注册</div>
        <div class="div2">已有账号？<a href="Login.jsp">登录</a></div>
        <div class="d1">
            用户名:<input type="text" name="username" class="i1" required/>
        </div>
        <div class="message"><%=error1%></div>
        <div class="d2">
            密&nbsp;码:<input type="password" name="password" class="i1" required/>
        </div>
        <div class="d3">
            确认密码:<input type="password"  name="confirmpassword" class="i1" required/>
        </div>
        <div class="message"><%=error2%></div>
        <div class="d2">
            邮 箱:<input type="text" name="email" class="i1" required/>
        </div>
        <div class="d1">
            手机号:<input type="text" name="phone" class="i1" required/>
        </div>
        <div align="center" class="div4">
            <input type="submit" name="sub" value="注册" class="sub1" />&nbsp;
            <input type="reset" name="register" value="重填" class="sub1" />
        </div>
    </form>
</div>
</body>
</html>
